home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9458 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  80 lines

  1. Newsgroups: comp.lang.ada,comp.lang.c++
  2. Path: alexandria.organon.com!alexandria!jsa
  3. From: jsa@organon.com (Jon S Anthony)
  4. Subject: Re: on OO differnces between Ada95 and C++
  5. In-Reply-To: mab@dst17.wdl.loral.com's message of 29 Feb 1996 23:58:29 GMT
  6. Message-ID: <JSA.96Mar1152347@organon.com>
  7. Sender: news@organon.com (news)
  8. Organization: Organon Motives, Inc.
  9. References: <4gh204$l7n@qualcomm.com> <DnDuA4.8GC@bton.ac.uk>
  10.     <4gvk2b$sjq@watnews1.watson.ibm.com> <4h5ej5$168@wdl1.wdl.loral.com>
  11. Date: Fri, 1 Mar 1996 20:23:47 GMT
  12.  
  13. In article <4h5ej5$168@wdl1.wdl.loral.com> mab@dst17.wdl.loral.com (Mark A Biggar) writes:
  14.  
  15. > How does this interact with "use type T;"?
  16.  
  17. Like you expect.
  18.  
  19. > package A is
  20. >     type T is new integer;
  21. >     function "+"(L,R: T) return T;
  22. > end A;
  23. > with A;
  24. > package B is
  25. >     subtype T is A.T;
  26. > end B;
  27. > with B;
  28. > procedure C is
  29. >     X: B.T;
  30. >     use type B.T;
  31. > begin
  32. >     X := X + X;   --- what "+" operator do I get here if any?
  33. > end C;
  34.  
  35. A."+"(L,R: T) return T;
  36.  
  37. As I recall the important bits are:
  38.  
  39. 3.2(8)
  40.  
  41. "A subtype of a given type is a combination of the type, a constraint
  42. on values of the type, and certain attributes specific to the
  43. subtype. The given type is called the type of the subtype. Similarly,
  44. the associated constraint is called the constraint of the subtype. The
  45. set of values of a subtype consists of the values of its type that
  46. satisfy its constraint. Such values belong to the subtype."
  47.  
  48. 3.2.2(8)
  49.  
  50. "A subtype_mark shall resolve to denote a subtype. The type _determined
  51. by a subtype_mark is the type of the subtype_ denoted by the
  52. subtype_mark."
  53.  
  54. [emphasis mine]
  55.  
  56. 8.4(8)
  57. "...
  58. For each type T or T'Class _determined by a subtype_mark_ of a
  59. use_type_clause whose scope encloses a place, the declaration of each
  60. primitive operator of type T is potentially use-visible at this place
  61. if its declaration is visible at this place."
  62.  
  63. [emphasis mine]
  64.  
  65.  
  66. /Jon
  67.  
  68.  
  69. -- 
  70. Jon Anthony
  71. Organon Motives, Inc.
  72. 1 Williston Road, Suite 4
  73. Belmont, MA 02178
  74.  
  75. 617.484.3383
  76. jsa@organon.com
  77.  
  78.